package com.example.lib_router

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.example.base.RoutePath


/**
 * 全局降级策略(处理路由跳转页面找不见的场景)
 */
@Route(path = RoutePath.PATH_GLOBAL_DEGRADE)
class GlobalDegradeService :DegradeService{

    private lateinit var mContext:Context

    override fun init(context: Context?) {
        context?.let {
            mContext=it
        }
    }

    override fun onLost(context: Context?, postcard: Postcard?) {
        postcard?.group="app"
        postcard?.path="/app/AppsActivity"
        postcard?.navigation()
    }
}